import psutil,time
def getLoginInfo():
    username = []
    user_host = []
    time_start = []
    for i in psutil.users():
        username.append(i.name)
        user_host.append(i.host)
        time_start.append(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(i.started)))

    return [username,user_host,time_start]

if __name__ == "__main__":
    userinfo = getLoginInfo()
    for i in range(len(userinfo[0])):
        print(" %-15s:%s host: %s Login in Time: %s" % ("User",
                                                        userinfo[0][i],
                                                        userinfo[1][i],
                                                        userinfo[2][i]))